Simplify scripts/findLatestTreatedCommentsForChannelsBeingTreated.py
This commit is contained in:
parent
3ca58b2466
commit
654769b80b
@ -9,7 +9,7 @@ path = 'channels/'
|
||||
os.chdir(path)
|
||||
|
||||
def getTimestampFromDateString(dateString):
|
||||
return int(time.mktime(datetime.datetime.strptime(dateString, "%Y-%m-%dT%H:%M:%SZ").timetuple()))
|
||||
return int(time.mktime(datetime.datetime.strptime(dateString, '%Y-%m-%dT%H:%M:%SZ').timetuple()))
|
||||
|
||||
for channelId in list(os.walk('.'))[1]:
|
||||
channelId = channelId[2:]
|
||||
@ -26,8 +26,7 @@ for channelId in list(os.walk('.'))[1]:
|
||||
snippet = snippet['topLevelComment']['snippet']
|
||||
latestTreatedCommentDate = snippet['publishedAt']
|
||||
url = f'https://yt.lemnoslife.com/noKey/channels?part=snippet&id={channelId}'
|
||||
content = requests.get(url).text
|
||||
data = json.loads(content)
|
||||
data = requests.get(url).json()
|
||||
channelCreationDate = data['items'][0]['snippet']['publishedAt']
|
||||
#print(channelCreationDate)
|
||||
# Timing percentage not taking into account the not uniform in time distribution of comments. Note that in the case of the last request is to list replies to a comment, the percentage might goes a bit backward, as replies are posted after the initial comment.
|
||||
|
Loading…
Reference in New Issue
Block a user