santhoshse7en / news-fetch

A Python Package which helps to scrape all news details from any news websites
MIT License
180 stars 109 forks source link

Getting TypeError when I try to import google_search and newspaper modules #3

Closed prakharrathi25 closed 3 years ago

prakharrathi25 commented 4 years ago

This is the error that I got. TypeError: attrs() got an unexpected keyword argument 'eq'

MashodRana commented 4 years ago

I found that the google_search module does not exist under the news module. google contains the google_search module.

You can try this:

from newsfetch.google import google_search

prakharrathi25 commented 4 years ago

Hi, I tried this as well and it's still not working. Did you install the library using pip or did you clone it?

prakharrathi25 commented 4 years ago

Attaching the complete error message here @MashodRana @santhoshse7en

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-70-99038758192b> in <module>
----> 1 from newsfetch.google import google_search

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\newsfetch\google.py in <module>
----> 1 from newsfetch.utils import (BeautifulSoup, Options, UserAgent, get, re, sys,
      2                               webdriver)
      3 
      4 
      5 class google_search:

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\newsfetch\utils.py in <module>
     11 from fake_useragent import UserAgent
     12 from newspaper import Article
---> 13 from newsplease import NewsPlease
     14 from requests import get
     15 from selenium import webdriver

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\newsplease\__init__.py in <module>
     10 
     11 from newsplease.pipeline.extractor import article_extractor
---> 12 from newsplease.crawler.items import NewscrawlerItem
     13 from dotmap import DotMap
     14 from newsplease.pipeline.pipelines import ExtractedInformationStorage

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\newsplease\crawler\items.py in <module>
      4 # http://doc.scrapy.org/en/latest/topics/items.html
      5 
----> 6 import scrapy
      7 
      8 

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\scrapy\__init__.py in <module>
     10 
     11 # Declare top-level shortcuts
---> 12 from scrapy.spiders import Spider
     13 from scrapy.http import Request, FormRequest
     14 from scrapy.selector import Selector

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\scrapy\spiders\__init__.py in <module>
      8 
      9 from scrapy import signals
---> 10 from scrapy.http import Request
     11 from scrapy.utils.trackref import object_ref
     12 from scrapy.utils.url import url_is_from_spider

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\scrapy\http\__init__.py in <module>
      9 
     10 from scrapy.http.request import Request
---> 11 from scrapy.http.request.form import FormRequest
     12 from scrapy.http.request.rpc import XmlRpcRequest
     13 from scrapy.http.request.json_request import JsonRequest

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\scrapy\http\request\form.py in <module>
     14 from scrapy.http.request import Request
     15 from scrapy.utils.python import to_bytes, is_listlike
---> 16 from scrapy.utils.response import get_base_url
     17 
     18 

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\scrapy\utils\response.py in <module>
      8 import tempfile
      9 
---> 10 from twisted.web import http
     11 from scrapy.utils.python import to_bytes, to_unicode
     12 from w3lib import html

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\twisted\web\http.py in <module>
    100 from incremental import Version
    101 from twisted.python.components import proxyForInterface
--> 102 from twisted.internet import interfaces, protocol, address
    103 from twisted.internet.defer import Deferred
    104 from twisted.internet.interfaces import IProtocol

c:\users\hp\appdata\local\programs\python\python36\lib\site-packages\twisted\internet\address.py in <module>
     99 
    100 
--> 101 @attr.s(hash=False, repr=False, eq=False)
    102 @implementer(IAddress)
    103 class UNIXAddress(object):

TypeError: attrs() got an unexpected keyword argument 'eq' 
MashodRana commented 4 years ago

@prakharrathi25 I installed using pip.

And you can see in the issues, that I have opened another issue that is about google_search module

It will be more convenient if you provide a snippet of your code

santhoshse7en commented 4 years ago

Check once now. I have made some alters in the code. Now its working. please install news-fetch==0.2.5

Capture

prakharrathi25 commented 4 years ago

@prakharrathi25 I installed using pip.

And you can see in the issues, that I have opened another issue that is about google_search module

It will be more convenient if you provide a snippet of your code

Hi, this was an error that came during the importing of the module. I will install the updated version now. Thank you.

alyshahudson commented 4 years ago

I'm having a similar issue - I cannot use google_search because of the chrome version It doesn't look like Chrome 86 will be released until October 6 - how is that a dependency? image

santhoshse7en commented 4 years ago

@alyshahudson. Hi, Sorry for the delayed response.

I have written the google_search function with a python module called https://pypi.org/project/chromedriver-binary/ this module helps to avoid manual entering of chrome driver location in the code.

To get better usability, please do check your chrome version installed in your system. And also, check with the related version from https://pypi.org/project/chromedriver-binary/#history and install it in your system.

Check then; it will work fine.

I hope that I have answered your query. Thank You :)