crawlerdetect icon indicating copy to clipboard operation
crawlerdetect copied to clipboard

Add version number method to CrawlerDetect()

Open Mjboothaus opened this issue 11 months ago • 2 comments

It would be nice to be able to easily return the package version number (so that the status of a crawler can be version-stamped). Cheers! :)

Mjboothaus avatar Aug 02 '23 03:08 Mjboothaus

@Mjboothaus could you write an example, please? How do you want to use it?

moskrc avatar Aug 02 '23 06:08 moskrc

Hi Vitalii - thanks for your prompt reply.

What I am trying to achieve is the following:

  • The list of known crawlers changes through time
  • Therefore as well as looking up if the user_agent identifier is a crawler or not, I would like to record the version of the code that produced this result i.e. something may not be a known crawler at a point in time and then is later identified as such.

I hope this makes sense.

So for example:

Crawler name User Agent ID CrawlerDetect version Go-http-client Go-http-client/1.1,gzip(gfe) 0.1.5

crawler_detect.isCrawler(user_agent).getMatches()

maybe also have a method like:

crawler_detect.version()

Although I think there is the package_version and also a database_version (of known crawlers) - the later is probably more useful.

I noticed that you do have a get_crawlerdetect_version() in __main.py__ however I don't think this is exposed? (Apologies if I have missed something).

Mjboothaus avatar Aug 03 '23 01:08 Mjboothaus