twintproject / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
15.66k stars 2.72k forks source link

ValueError: 'twitter.com' does not appear to be an IPv4 or IPv6 address #596

Closed scientes closed 4 years ago

scientes commented 4 years ago

Issue Template

Please use this template!

Initial Check

If the issue is a request please specify that it is a request in the title (Example: [REQUEST] more features). If this is a question regarding 'twint' please specify that it's a question in the title (Example: [QUESTION] What is x?). Please only submit issues related to 'twint'. Thanks.

Make sure you've checked the following:

Command Ran

Please provide the exact command ran including the username/search/code so I may reproduce the issue. https://colab.research.google.com/drive/1AOXQxkOWbq7KEHWVBRiOrYhTOSg3QTqq#scrollTo=1lZrarvrzsVT from https://github.com/twintproject/twint-utils/blob/master/mufos.py

and twint -u NullByte

Description of Issue

Please use as much detail as possible.


finding followers...(ignore errors)

CRITICAL:root:twint.get:User:'str' object has no attribute 'isascii'


ValueError Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/yarl/init.py in _encode_host(cls, host) 666 ip, sep, zone = host.partition("%") --> 667 ip = ip_address(ip) 668 except ValueError:

17 frames

ValueError: 'mobile.twitter.com' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/yarl/init.py in _encode_host(cls, host) 669 # IDNA encoding is slow, 670 # skip it for ASCII-only strings --> 671 if host.isascii(): 672 return host 673 try:

AttributeError: 'str' object has no attribute 'isascii'

cli example:

twint -u NullByte CRITICAL:root:twint.get:User:'str' object has no attribute 'isascii' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/yarl/init.py", line 667, in _ encode_host ip = ip_address(ip) File "/usr/lib/python3.6/ipaddress.py", line 54, in ip_address address) ValueError: 'twitter.com' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/twint", line 11, in sys.exit(run_as_command()) File "/usr/local/lib/python3.6/dist-packages/twint/cli.py", line 303, in run_a s_command main() File "/usr/local/lib/python3.6/dist-packages/twint/cli.py", line 295, in main run.Search(c) File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 292, in Searc h run(config, callback) File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 213, in run get_event_loop().run_until_complete(Twint(config).main(callback)) File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_compl ete return future.result() File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 154, in main await task File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 198, in run await self.tweets() File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 137, in tweet s await self.Feed() File "/usr/local/lib/python3.6/dist-packages/twint/run.py", line 57, in Feed response = await get.RequestUrl(self.config, self.init, headers=[("User-Agen t", self.user_agent)]) File "/usr/local/lib/python3.6/dist-packages/twint/get.py", line 119, in Reque stUrl response = await Request(_url, params=params, connector=_connector, headers= headers) File "/usr/local/lib/python3.6/dist-packages/twint/get.py", line 147, in Reque st return await Response(session, url, params) File "/usr/local/lib/python3.6/dist-packages/twint/get.py", line 152, in Respo nse async with session.get(url, ssl=True, params=params, proxy=httpproxy) as res ponse: File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 1012, in aenter self._resp = await self._coro File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 380, in _request url = URL(str_orurl) File "/usr/local/lib/python3.6/dist-packages/yarl/init.py", line 170, in _new val.username, val.password, host, port, encode=True File "/usr/local/lib/python3.6/dist-packages/yarl/init.py", line 688, in _ make_netloc ret = cls._encode_host(host) File "/usr/local/lib/python3.6/dist-packages/yarl/init_.py", line 671, in encode_host if host.isascii(): AttributeError: 'str' object has no attribute 'isascii'



### Environment Details
>
- jupyter notebook
- same/similar things happend when using win10 and ubuntu18.04 (python3.6.9)
also ocurred when trying to use cli
same thing happend when trying to use the container version https://github.com/twintproject/twint-docker
pielco11 commented 4 years ago

The error that you are having seems not to be related to Twint itself