Iceloof / GoogleNews

Script for GoogleNews
https://pypi.org/project/GoogleNews/
MIT License
314 stars 88 forks source link

two bugs for new update #120

Open alinemati-uwm opened 10 months ago

alinemati-uwm commented 10 months ago

thanks for update, I can see two bugs there:

I search for chatgot to check

URL looks extra stuff which does not open the link 'desc': '' is empty Mycode: from GoogleNews import GoogleNews googlenews = GoogleNews() googlenews.enableException(True) googlenews.set_lang('en') googlenews.set_period('1d') googlenews.set_time_range('08/11/2023','02/28/2020') googlenews.set_encode('utf-8') googlenews.search('Chatgpt') result = googlenews.page_at(2) result

My result: [{'title': 'Hackers take on ChatGPT with support from White House', 'media': 'CNN', 'date': '6 hours ago', 'datetime': datetime.datetime(2023, 8, 11, 20, 8, 33, 681797), 'desc': '', 'link': '/url?esrc=s&q=&rct=j&sa=U&url=https://www.cnn.com/videos/world/2023/08/11/exp-hackers-ai-vegas-lkl-081102pseg2-cnni-world.cnn&ved=2ahUKEwi11JzzhNaAAxUxm1YBHTz2Dx04ChDF9AF6BAgDEAI&usg=AOvVaw14nsFJTPwZeSPlNUzqrOE5', 'img': 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='},

alinemati-uwm commented 10 months ago

I fixed it by myself

Gary-HO commented 10 months ago

Hi @alinemati-uwm,

Would you please provide the solution to the empty "desc" problem? I encountered the bug too but I can't figure out the solution

tin8420 commented 10 months ago

Hi all, I also found out this issue which the URL contains extra stuff so that the content can't be downloaded properly. Is there any solution ?

tin8420 commented 10 months ago

BTW I already trimmed the URL to proper format which start with htttps but also not working.

alinemati-uwm commented 10 months ago

I extracted whole code and updated. please use below link if you want to use it

colab

tin8420 commented 9 months ago

Hi @alinemati-uwm, I was wondering if you have update version for 1.6.10 because URL in this version still contains extra stuff so that article couldn't be downloaded successfully

alinemati-uwm commented 9 months ago

Hi @alinemati-uwm, I was wondering if you have update version for 1.6.10 because URL in this version still contains extra stuff so that article couldn't be downloaded successfully

No sure what do you need but the result is json file which you can extract whatever you want.

tin8420 commented 9 months ago

Thanks, may I ask which version are you using now? because the latest version is 1.6.10 and the last time you provide modified code is version 1.6.9

alinemati-uwm commented 9 months ago

I updated the python script on the colab. you can use it and run locally. it works. colab's linke is above-mentioned.

tin8420 commented 9 months ago

@alinemati-uwm Thanks a lot, I try your code but it failed. would you check if you modified in the latest version(1.6.10)? image

prigioni commented 8 months ago

Hi @alinemati-uwm, I run colab, but it returns []. Can you help me?