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.75k stars 2.72k forks source link

How to display "Twint response" on html page? As the data is displayed only on command promt #642

Closed Jyothsna2795 closed 4 years ago

Jyothsna2795 commented 4 years ago

I am beginner and trying to write API call for displaying Twint response on html page, but the extracted data is displayed in command prompt. Please guide me through this.

I am using Updated version of twint, Python 3.7, Django 3.0, windows 10

Below is my code

views.py

class UserName(APIView):
    def get(self,request,format=None):
        return self.username(request,request.query_params)
    def username(self, request, result):
        c = twint.Config()
        asyncio.set_event_loop(asyncio.new_event_loop())
        result = twint.run.Search(c)
        return Response(result)
pielco11 commented 4 years ago

The type of twint.run.Search is void. Meaning that's a function that returns "nothing"

You may want to save the tweets in a list and then return in, also you may want to have a quiet output (check in the wiki Hide_output and tweets_list)

Jyothsna2795 commented 4 years ago

@pielco11 Thank you