IDLE (Python 3.10 64-bit)
Windows 10
---------------------------
Есть такой скрипт:
Выдаёт ошибку:
File "E:\__Мои скрипты\1_test\parser_yotube.py", line 5, in <module>
from BeautifulSoup import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'
Process finished with exit code 1
-------------------------------------------------
Пытаюсь установить модуль, опять ошибка:
WARNING: Discarding https://files.pythonhosted.org/pack...d9f0a390a7a054bfb7b147a50b2866fb116b8909dfd37 (from https://pypi.org/simple/beautifulsoup/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement BeautifulSoup (from versions: 3.2.0, 3.2.1, 3.2.2)
ERROR: No matching distribution found for BeautifulSoup
Windows 10
---------------------------
Есть такой скрипт:
Python:
# coding: utf8
# == pars_playlist.py
# == select short information from Yotube playlist --
from urllib.request import urlopen
from BeautifulSoup import BeautifulSoup
print()
"pars_playlist working..."
# == get first linkof playlist ==
url = input('input link:')
url = "https://www.youtube.com/playlist?list=PLku9se_HAVOrs3p_jJzZAbV3BEODrhS3j"
fh = open('data.txt', 'w')
cur_num = 1 # index of reading page
try:
while True:
# -- get curent page --
print()
cur_num
print()
url
content = urlopen(url)
page = content.read()
# -- cut head
soup = BeautifulSoup(page)
body = soup.find('body')
# get current title
span = body.find(id="ecw-title")
title = span.getText()
print()
title
# get list of all links
ol = body.find(id="playlist-autoscroll-list")
lis = ol.findAll('li')
# soup for current page
for idx, li in enumerate(lis): # seek for picture
li_title = li["data-video-title"]
if li_title == title: break
video_id = li["data-video-id"]
# get picture information
img = li.find('img')
img_src = img['src']
pos = img_src.find('?')
if pos > 0: img_src = img_src[:pos]
# get description of page
descr = body.find(id="eow-description")
descr_text = descr.getText()
# save information
fh.write(title.encode('utf8') + '\n')
fh.write(video_id.encode('utf8') + '\n')
fh.write(img_src.encode('utf8') + '\n')
fh.write(descr_text.encode('utf8') + '\n')
fh.write('\n')
if idx >= len(lis) - 1: break
# get next url
idx += 1
li = lis[idx]
anc = li.find('a')
href = anc['href']
url = "https://www.youtube.com" + href
cur_num = cur_num + 1
# == 05 end of work ==
except:
print()
"exception: " + str(cur_num)
pass
finally:
fh.close()
print()
"ok"
File "E:\__Мои скрипты\1_test\parser_yotube.py", line 5, in <module>
from BeautifulSoup import BeautifulSoup
ModuleNotFoundError: No module named 'BeautifulSoup'
Process finished with exit code 1
-------------------------------------------------
Пытаюсь установить модуль, опять ошибка:
WARNING: Discarding https://files.pythonhosted.org/pack...d9f0a390a7a054bfb7b147a50b2866fb116b8909dfd37 (from https://pypi.org/simple/beautifulsoup/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement BeautifulSoup (from versions: 3.2.0, 3.2.1, 3.2.2)
ERROR: No matching distribution found for BeautifulSoup