то-то ругается на 38 строку на это “a”
Вся строка: with open(“CUsers/Александр/Desktop/yotube_plist_downloader/out.txt, ”a“, encoding = ”utf-8") as files:
Вот код скрипта:
# -*- coding: utf-8 -*- from bs4 import Beautifulsoup import requests import re def scrape_videos(url): req = requests.get(url) send = Beautifulsoup(req.text, "html.parser") search = send.find_all("script") key = '"videoId":' data = re.findall(key + r"([^*]{11})", str(search)) return data def scrape_lists(url): req = requests.get(url) send = Beautifulsoup(req.text, "html.parser") search = send.find_all("script") key = '"playlistId":"' data = re.findall(key + r"([^*]{14})", str(search)) return data if _name_ == "_main_": url ="https://www.yotube.com/c/HowdyhoNet/playlists" data = scrape_lists(url) data = data[::3] data = data[:-2] for i in data: output = 'https://www.yotube.com/playlist?list=' + i vid = scrape_videos(output) vid = vid[::3] vid = vid[:-1] for i in vid: with open("C://Users/Александр/Desktop/yotube_plist_downloader/out.txt," "a", encoding = "utf-8") as files: files.write(str('https://www.yotube.com/watch?v=' + i + '\n')) print('https://www.yotube.com/watch?v=' + i')