Giter Site home page Giter Site logo

fake_traffic's Introduction

Python >= 3.8

fake_traffic

Internet traffic generator. Utilizes real-time google search trends by specified parameters.


Install

pip install -U fake_traffic

Install chromium browser with dependencies

playwright install --with-deps chromium

CLI version

fake_traffic -h

CLI examples:

# user located in Turkey, who speaks Kurdish and is interested in hot stories
fake_traffic -c tr -l ku-tr -ca h
# save logs into 'fake_traffic.log'
fake_traffic -c ru -l ru-ru -ca s -lf
# use none-headless mode
fake_traffic -c en -l en-us -ca t -nh
# limit the number of tabs in the browser to 2 
fake_traffic -c en -l en-us -ca t -t 2

Simple usage

from fake_traffic import FakeTraffic

FakeTraffic(country="US", language="en-US").crawl()

Advanced usage

from fake_traffic import FakeTraffic

ft = FakeTraffic(country="US", language="en-US", category="h", headless=True)
    """Internet traffic generator. Utilizes real-time google search trends by specified parameters.
    country = country code ISO 3166-1 Alpha-2 code (https://www.iso.org/obp/ui/),
    language = country-language code ISO-639 and ISO-3166 (https://www.fincher.org/Utilities/CountryLanguageList.shtml),
    category = сategory of interest of a user (defaults to "h"):
               "all" (all), "b" (business), "e" (entertainment), 
               "m" (health), "s" (sports), "t" (sci/tech), "h" (top stories);
    headless = True/False (defaults to True);
    tabs = limit the number of tabs in browser (defaults to 3).
    """
ft.crawl()

Example

Using realtime search trends of a user located in Turkey, who speaks Kurdish and is interested in hot stories

Find Turkey country code (ISO 3166-1 Alpha-2 code):

  • country = "TR"

Find Turkey country-language code (ISO-639 and ISO-3166):

  • english "en-TR",
  • kurdish "ku-TR",
  • turkish "tr-TR".

Set the category ("h", because the user in the example is interested in hot stories):

  • category = "h"

Starting in none-headless mode:

  • headless=False
from fake_traffic import FakeTraffic

ft = FakeTraffic(country="TR", language="ku-TR", category="h", headless=False)
ft.crawl()

P.S. you can select language from other country. For example, such combinations are also correct:

FakeTraffic(country="TR", language="ar-TR").crawl()
FakeTraffic(country="US", language="he-IL").crawl()
FakeTraffic(country="DE", language="hi-IN").crawl()

Other examples

Country Language Function
France French FakeTraffic(country="FR", language="fr-FR")
Germany German FakeTraffic(country="DE", language="de-DE", category="b")
India English FakeTraffic(country="IN", language="en-IN", category="all")
India Hindi FakeTraffic(country="IN", language="hi-IN")
Russia English FakeTraffic(country="RU", language="en-US", category="b", headless=False)
Russia Russian FakeTraffic(country="RU", language="ru-RU")
Brazil Portuguese FakeTraffic(country="BR", language="pt-BR", category="s")
United Kingdom English FakeTraffic(country="GB", language="en-GB")
United States English FakeTraffic(country="US", language="en-US", tabs=4)
United States Hebrew Israel FakeTraffic(country="US", language="he-IL")

fake_traffic's People

Contributors

amenpunk avatar deedy5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fake_traffic's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.