|
|
@@ -83,9 +83,9 @@ class Comments(qwarc.Item): |
|
|
|
if not response or response.status != 200: |
|
|
|
self.logger.error('Could not fetch video page') |
|
|
|
return |
|
|
|
contents = await response.read() |
|
|
|
content = await response.read() |
|
|
|
|
|
|
|
sessionToken = qwarc.utils.str_get_between(contents, b'"XSRF_TOKEN":"', b'"') |
|
|
|
sessionToken = qwarc.utils.str_get_between(content, b'"XSRF_TOKEN":"', b'"') |
|
|
|
if not sessionToken: |
|
|
|
self.logger.error('Could not find session token') |
|
|
|
return |
|
|
@@ -94,15 +94,15 @@ class Comments(qwarc.Item): |
|
|
|
return |
|
|
|
sessionToken = sessionToken.decode('ascii') |
|
|
|
|
|
|
|
sectionIdentifierPos = contents.find(b'"comment-item-section"') |
|
|
|
sectionIdentifierPos = content.find(b'"comment-item-section"') |
|
|
|
if sectionIdentifierPos < 0: |
|
|
|
self.logger.error('Could not find comment section identifier') |
|
|
|
return |
|
|
|
continuationStartPos = contents.rfind(b'"continuation":', 0, sectionIdentifierPos) |
|
|
|
continuationStartPos = content.rfind(b'"continuation":', 0, sectionIdentifierPos) |
|
|
|
if continuationStartPos < 0: |
|
|
|
self.logger.error('Could not find continuation start position') |
|
|
|
return |
|
|
|
section = contents[continuationStartPos:sectionIdentifierPos] |
|
|
|
section = content[continuationStartPos:sectionIdentifierPos] |
|
|
|
continuationToken = qwarc.utils.str_get_between(section, b'"continuation":"', b'"') |
|
|
|
if continuationToken.lstrip(b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-') not in (b'', b'=', b'=='): |
|
|
|
self.logger.error('Unexpected continuation token value: {continuationToken!r}') |
|
|
|