Browse Source

Disable credit retrieval

pull/11/head
tech234a 3 years ago
parent
commit
2db5e71e87
3 changed files with 7 additions and 32 deletions
  1. +1
    -24
      discovery.py
  2. +1
    -1
      tracker.py
  3. +5
    -7
      worker.py

+ 1
- 24
discovery.py View File

@@ -123,34 +123,11 @@ def getmetadata(mysession, vid, ccenabledonly=False):
except BaseException as e:
print(e)
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):
break
return ccenabled, creditdata, recvids, recchans, recmixes, recplayl
return ccenabled, recvids, recchans, recmixes, recplayl
if __name__ == "__main__":
from sys import argv


+ 1
- 1
tracker.py View File

@@ -9,7 +9,7 @@ from os.path import isfile
from json import loads

# https://github.com/ArchiveTeam/tencent-weibo-grab/blob/9bae5f9747e014db9227821a9c11557267967023/pipeline.py
VERSION = "20201002.01"
VERSION = "20201014.01"

TRACKER_ID = "ext-yt-communitycontribs"
TRACKER_HOST = "trackerproxy.meo.ws"


+ 5
- 7
worker.py View File

@@ -135,11 +135,9 @@ def threadrunner():
print(e)
print("Error in retrieving information, waiting 30 seconds and trying again")
sleep(30)
if info[0] or info[1]: # ccenabled or creditdata
if info[0]: # ccenabled or creditdata
if not isdir("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]:
for langcode in langs:
@@ -153,13 +151,13 @@ def threadrunner():

jobs.put(("complete", None, "video:"+vid))

for videodisc in info[2]:
for videodisc in info[1]:
jobs.put(("submitdiscovery", videodisc, tracker.ItemType.Video))
for channeldisc in info[3]:
for channeldisc in info[2]:
jobs.put(("submitdiscovery", channeldisc, tracker.ItemType.Channel))
for mixdisc in info[4]:
for mixdisc in info[3]:
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(("complete", None, "video:"+vid))


Loading…
Cancel
Save