@@ -123,34 +123,11 @@ def getmetadata(mysession, vid, ccenabledonly=False): | |||||
except BaseException as e: | except BaseException as e: | ||||
print(e) | print(e) | ||||
print("Exception in discovery, continuing anyway") | print("Exception in discovery, continuing anyway") | ||||
creditdata = {} | |||||
if not ccenabledonly: | |||||
try: | |||||
mdinfo = initdata["contents"]["twoColumnWatchNextResults"]["results"]["results"]["contents"][1]["videoSecondaryInfoRenderer"]["metadataRowContainer"]["metadataRowContainerRenderer"]["rows"] | |||||
for item in mdinfo: | |||||
if item["metadataRowRenderer"]["title"]["simpleText"].startswith("Caption author"): #the request to /watch needs to be in English for this to work | |||||
try: | |||||
desl = langcodes[item["metadataRowRenderer"]["title"]["simpleText"].split("(", 1)[1][:-1]] | |||||
except KeyError as e: | |||||
#print(e) | |||||
print("Language code conversion error, using language name") | |||||
desl = item["metadataRowRenderer"]["title"]["simpleText"].split("(", 1)[1][:-1] | |||||
creditdata[desl] = [] | |||||
for itemint in item["metadataRowRenderer"]["contents"]: | |||||
creditdata[desl].append({"name": itemint["runs"][0]["text"], "channel": itemint["runs"][0]["navigationEndpoint"]["browseEndpoint"]["browseId"]}) | |||||
except KeyError as e: | |||||
#print("Video does not have credits") | |||||
pass | |||||
#raise | |||||
#print(e) | |||||
if initplay and (initdata or ccenabledonly): | if initplay and (initdata or ccenabledonly): | ||||
break | break | ||||
return ccenabled, creditdata, recvids, recchans, recmixes, recplayl | |||||
return ccenabled, recvids, recchans, recmixes, recplayl | |||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
from sys import argv | from sys import argv | ||||
@@ -9,7 +9,7 @@ from os.path import isfile | |||||
from json import loads | from json import loads | ||||
# https://github.com/ArchiveTeam/tencent-weibo-grab/blob/9bae5f9747e014db9227821a9c11557267967023/pipeline.py | # https://github.com/ArchiveTeam/tencent-weibo-grab/blob/9bae5f9747e014db9227821a9c11557267967023/pipeline.py | ||||
VERSION = "20201002.01" | |||||
VERSION = "20201014.01" | |||||
TRACKER_ID = "ext-yt-communitycontribs" | TRACKER_ID = "ext-yt-communitycontribs" | ||||
TRACKER_HOST = "trackerproxy.meo.ws" | TRACKER_HOST = "trackerproxy.meo.ws" | ||||
@@ -135,11 +135,9 @@ def threadrunner(): | |||||
print(e) | print(e) | ||||
print("Error in retrieving information, waiting 30 seconds and trying again") | print("Error in retrieving information, waiting 30 seconds and trying again") | ||||
sleep(30) | sleep(30) | ||||
if info[0] or info[1]: # ccenabled or creditdata | |||||
if info[0]: # ccenabled or creditdata | |||||
if not isdir("out/"+str(vid).strip()): | if not isdir("out/"+str(vid).strip()): | ||||
mkdir("out/"+str(vid).strip()) | mkdir("out/"+str(vid).strip()) | ||||
if info[1]: | |||||
open("out/"+str(vid).strip()+"/"+str(vid).strip()+"_published_credits.json", "w").write(dumps(info[1])) | |||||
if info[0]: | if info[0]: | ||||
for langcode in langs: | for langcode in langs: | ||||
@@ -153,13 +151,13 @@ def threadrunner(): | |||||
jobs.put(("complete", None, "video:"+vid)) | jobs.put(("complete", None, "video:"+vid)) | ||||
for videodisc in info[2]: | |||||
for videodisc in info[1]: | |||||
jobs.put(("submitdiscovery", videodisc, tracker.ItemType.Video)) | jobs.put(("submitdiscovery", videodisc, tracker.ItemType.Video)) | ||||
for channeldisc in info[3]: | |||||
for channeldisc in info[2]: | |||||
jobs.put(("submitdiscovery", channeldisc, tracker.ItemType.Channel)) | jobs.put(("submitdiscovery", channeldisc, tracker.ItemType.Channel)) | ||||
for mixdisc in info[4]: | |||||
for mixdisc in info[3]: | |||||
jobs.put(("submitdiscovery", mixdisc, tracker.ItemType.MixPlaylist)) | jobs.put(("submitdiscovery", mixdisc, tracker.ItemType.MixPlaylist)) | ||||
for playldisc in info[5]: | |||||
for playldisc in info[4]: | |||||
jobs.put(("submitdiscovery", playldisc, tracker.ItemType.Playlist)) | jobs.put(("submitdiscovery", playldisc, tracker.ItemType.Playlist)) | ||||
#jobs.put(("complete", None, "video:"+vid)) | #jobs.put(("complete", None, "video:"+vid)) | ||||