Python 초보인데 트위터 웹크롤링 중 TypeError ( GetOldTweets3 패키지 사용)가 나는데 도와주실 분 계신가요? 구글링을 해도 같은 문제에 대한 오류해결이 없어서 부탁드립니다!

조회수 1139회

안녕하세요. 트위터 개발자키 사용 안하고 패키지 사용하여 웹크롤링 중입니다. 그 중 계속 TypeError가 발생하여 질문드립니다.

이미지 이미지 이미지

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

An error occured during an HTTP request: HTTP Error 404: Not Found
Try to open in browser: https://twitter.com/search?q=%EB%AF%B8%EB%82%98%EB%A6%AC%20OR%20%EC%98%A4%EC%8A%A4%EC%B9%B4%20since%3A2021-03-03%20until%3A2021-04-03&src=typd
Traceback (most recent call last):
  File "C:\Users\rladb\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py", line 343, in getJsonResponse
    response = opener.open(url)
  File "C:\Users\rladb\anaconda3\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\Users\rladb\anaconda3\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "C:\Users\rladb\anaconda3\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\Users\rladb\anaconda3\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\Users\rladb\anaconda3\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\rladb\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-21-b4287f1acbb7>", line 1, in <module>
    tweet = got.manager.TweetManager.getTweets(tweetCriteria)[1]
  File "C:\Users\rladb\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py", line 65, in getTweets
    json = TweetManager.getJsonResponse(tweetCriteria, refreshCursor, cookieJar, proxy, user_agent, debug=debug)
  File "C:\Users\rladb\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py", line 348, in getJsonResponse
    sys.exit()
SystemExit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\rladb\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 1101, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "C:\Users\rladb\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 248, in wrapped
    return f(*args, **kwargs)
  File "C:\Users\rladb\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 281, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "C:\Users\rladb\anaconda3\lib\inspect.py", line 1515, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
AttributeError: 'tuple' object has no attribute 'tb_frame'
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
~\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py in getJsonResponse(tweetCriteria, refreshCursor, cookieJar, proxy, useragent, debug)
    342         try:
--> 343             response = opener.open(url)
    344             jsonResponse = response.read()

~\anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
    530             meth = getattr(processor, meth_name)
--> 531             response = meth(req, response)
    532 

~\anaconda3\lib\urllib\request.py in http_response(self, request, response)
    639         if not (200 <= code < 300):
--> 640             response = self.parent.error(
    641                 'http', request, response, code, msg, hdrs)

~\anaconda3\lib\urllib\request.py in error(self, proto, *args)
    568             args = (dict, 'default', 'http_error_default') + orig_args
--> 569             return self._call_chain(*args)
    570 

~\anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
    501             func = getattr(handler, meth_name)
--> 502             result = func(*args)
    503             if result is not None:

~\anaconda3\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)
    648     def http_error_default(self, req, fp, code, msg, hdrs):
--> 649         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    650 

HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

SystemExit                                Traceback (most recent call last)
    [... skipping hidden 1 frame]

<ipython-input-21-b4287f1acbb7> in <module>
----> 1 tweet = got.manager.TweetManager.getTweets(tweetCriteria)[1]
      2 print(tweet.text)

~\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py in getTweets(tweetCriteria, receiveBuffer, bufferLength, proxy, debug)
     64             while active:
---> 65                 json = TweetManager.getJsonResponse(tweetCriteria, refreshCursor, cookieJar, proxy, user_agent, debug=debug)
     66                 if len(json['items_html'].strip()) == 0:

~\anaconda3\lib\site-packages\GetOldTweets3\manager\TweetManager.py in getJsonResponse(tweetCriteria, refreshCursor, cookieJar, proxy, useragent, debug)
    347             print("Try to open in browser: https://twitter.com/search?q=%s&src=typd" % urllib.parse.quote(urlGetData))
--> 348             sys.exit()
    349 

SystemExit: 

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
    [... skipping hidden 1 frame]

~\anaconda3\lib\site-packages\IPython\core\interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
   2052                     stb = ['An exception has occurred, use %tb to see '
   2053                            'the full traceback.\n']
-> 2054                     stb.extend(self.InteractiveTB.get_exception_only(etype,
   2055                                                                      value))
   2056                 else:

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in get_exception_only(self, etype, value)
    752         value : exception value
    753         """
--> 754         return ListTB.structured_traceback(self, etype, value)
    755 
    756     def show_exception_only(self, etype, evalue):

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, context)
    627             chained_exceptions_tb_offset = 0
    628             out_list = (
--> 629                 self.structured_traceback(
    630                     etype, evalue, (etb, chained_exc_ids),
    631                     chained_exceptions_tb_offset, context)

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1365         else:
   1366             self.tb = tb
-> 1367         return FormattedTB.structured_traceback(
   1368             self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1369 

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1265         if mode in self.verbose_modes:
   1266             # Verbose modes need a full traceback
-> 1267             return VerboseTB.structured_traceback(
   1268                 self, etype, value, tb, tb_offset, number_of_lines_of_context
   1269             )

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
   1122         """Return a nice text document describing the traceback."""
   1123 
-> 1124         formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
   1125                                                                tb_offset)
   1126 

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
   1080 
   1081 
-> 1082         last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
   1083 
   1084         frames = self.format_records(records, last_unique, recursion_repeat)

~\anaconda3\lib\site-packages\IPython\core\ultratb.py in find_recursion(etype, value, records)
    380     # first frame (from in to out) that looks different.
    381     if not is_recursion_error(etype, value, records):
--> 382         return len(records), 0
    383 
    384     # Select filename, lineno, func_name to track frames with

TypeError: object of type 'NoneType' has no len()
  • 코드를 이미지로 올리지 마세요. 초보자 2021.9.22 09:47
  • 404 에러뜨는데 해당 라이브러리가 옛날 트위터 기준인듯 김호원 2021.9.23 14:35

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)