[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix google crawler - fix regex before json parsing #74

Closed
wants to merge 1 commit into from

Conversation

gcheron
Copy link
Contributor
@gcheron gcheron commented Jun 13, 2020

The regex in the google parser was not adapted anymore:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The fix containing the new regex passed the unit test (test_todo.py) so obtaining 5 beautiful cats!

@LuolinRowling
Copy link

Hi, seems this regex will fail when the content contains data:. eg.

"Improving new product development using big data: a case study of an electronics company"

Change the regex to r"^AF_initDataCallback\(\{key: 'ds:\d'.+data:(\[.+)\}\);?$" may solve this problem.

@pasqLisena
Copy link
Contributor

+1 for this pull request

@akayhanlar
Copy link

I have same problems.

@estellajaysong
Copy link
estellajaysong commented Sep 3, 2020

The regex in the google parser was not adapted anymore:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The fix containing the new regex passed the unit test (test_todo.py) so obtaining 5 beautiful cats!

When I try this fix I get another error 😢

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1546 column 1 (char 104330)

@estellajaysong
Copy link
estellajaysong commented Sep 3, 2020

Hi, seems this regex will fail when the content contains data:. eg.

"Improving new product development using big data: a case study of an electronics company"

Change the regex to r"^AF_initDataCallback\(\{key: 'ds:\d'.+data:(\[.+)\}\);?$" may solve this problem.

Also tried this one, but I get

raise s.error("invalid group reference %d" % index, pos)
re.error: invalid group reference 2 at position 1

@hongzio hongzio mentioned this pull request Oct 6, 2020
@hellock hellock closed this in de762cf Oct 26, 2020
hellock added a commit that referenced this pull request Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants