pythongoogle-trends

How to set the sub category of search term Google Trends - Pytrends


I am trying to fetch the results of Google Trends using Pytrends pytrends1.interest_over_time() there are terms that sometimes correspond to a regular search term vs a specific category like Peaky Blinders (as search term vs British Drama Series), where I would want to fetch the results for British Drama Series. I have observed the URL patterns as well and when toggling between generic search to a sub category it becomes encoded like:

regular search term: https://trends.google.com/trends/explore?q=peaky%20blinders&geo=IN

British TV Show: https://trends.google.com/trends/explore?geo=IN&q=%2Fm%2F0ql2gt3

How do I pass in the Pytrends API call that I want for British Drama Series?

enter image description here


Solution

  • From the pytrends documentation, there's a section that talks about "advanced keywords" which seems to be what you want. There's also some information about extracting the correct category for your search term, though it looks like you'll need to do that in a separate script before you can add the category to your main program.