pytrends icon indicating copy to clipboard operation
pytrends copied to clipboard

Last Hours Data Are Missing

Open kochlisGit opened this issue 4 years ago • 0 comments

I am trying to fetch the last N hours trends data of a keyword. To do that, I use the Pytrends package, using the get_historical_interest() function. Even though Google Trends' webpage does display the data up to now, it seems that the Pytrends API can't retrieve the last 3 hours. My code is this:

from pytrends.request import TrendReq

data = TrendReq().get_historical_interest(
    keywords=['bitcoin'],
    year_start=2022,
    month_start=2,
    day_start=21,
    hour_start=0,
    year_end=2022,
    month_end=2,
    day_end=21,
    hour_end=15
)

print(data)

I am trying to get the last 15 hours of data. However, the result i get is for the last 12 hours only:

date
2022-02-21 00:00:00 82 False 2022-02-21 01:00:00 74 False 2022-02-21 02:00:00 76 False 2022-02-21 03:00:00 72 False 2022-02-21 04:00:00 75 False 2022-02-21 05:00:00 78 False 2022-02-21 06:00:00 81 False 2022-02-21 07:00:00 79 False 2022-02-21 08:00:00 77 False 2022-02-21 09:00:00 74 False 2022-02-21 10:00:00 77 False 2022-02-21 11:00:00 84 False 2022-02-21 12:00:00 100 True

kochlisGit avatar Feb 23 '22 21:02 kochlisGit