Skip to content

Commit

Permalink
Merge pull request #6 from davidteather/nightly
Browse files Browse the repository at this point in the history
Travis CI & PyPi Package
  • Loading branch information
davidteather authored Sep 14, 2019
2 parents 98aea60 + 04926a5 commit 8aa1093
Show file tree
Hide file tree
Showing 32 changed files with 114 additions and 891 deletions.
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
dist: xenial
language: python
python:
- "3.7"

matrix:
allow_failures:
- python: "3.8-dev"
- python: "nightly"

addons:
firefox: "62.0.3"
# chrome: stable

install:
# - pip install seleniumbase
- pip install pytest

language: python
python:
- "3.7"

before_script:
# - "flake8 --exclude=temp"
# - "wget https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin/ && sudo chmod +x /usr/local/bin/chromedriver"
- "wget https://github.com/mozilla/geckodriver/releases/download/v0.25.0/geckodriver-v0.25.0-linux64.tar.gz -O /tmp/geckodriver.tar.gz && tar -C /opt -xzf /tmp/geckodriver.tar.gz && sudo chmod 755 /opt/geckodriver && sudo ln -fs /opt/geckodriver /usr/bin/geckodriver && sudo ln -fs /opt/geckodriver /usr/local/bin/geckodriver"
# - "wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && tar -xvf ./phantomjs-2.1.1-linux-x86_64.tar.bz2 && export PATH=$PWD/phantomjs-2.1.1-linux-x86_64/bin:$PATH"
# - "seleniumbase install geckodriver"
# - "wget https://github.com/mozilla/geckodriver/releases/download/v0.25.0/geckodriver-v0.25.0-linux64.tar.gz -o /tmp/geckodriver.tar.gz && tar -C /opt -xzf /tmp/geckodriver.tar.gz && sudo chmod 755 /opt/geckodriver && sudo ln -fs /opt/geckodriver /usr/bin/geckodriver && sudo ln -fs /opt/geckodriver /usr/local/bin/geckodriver"
# - python setup.py build
- "sudo apt-get install java-common"
- "pip install -r requirements.txt"
- "sudo apt-get install unzip"
- "wget https://github.com/lightbody/browsermob-proxy/releases/download/browsermob-proxy-2.1.4/browsermob-proxy-2.1.4-bin.zip -O /tmp/browsermob-proxy.zip && unzip /tmp/browsermob-proxy.zip && mv -f browsermob-proxy-2.1.4 browsermob-proxy"
# - "wget https://github.com/lightbody/browsermob-proxy/releases/download/browsermob-proxy-2.1.4/browsermob-proxy-2.1.4-bin.zip -O /tmp/browsermob-proxy.zip && unzip /tmp/browsermob-proxy.zip -d davidteather/TikTok-Api/ && mv -f davidteather/TikTok-Api/browsermob-proxy-2.1.4 davidteather/TikTok-Api/browsermob-proxy"
- "python setup.py install_lib"

script:
- pytest tests/test_trending.py
5 changes: 5 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file GENERATED by distutils, do NOT edit
setup.cfg
setup.py
TikTokApi\__init__.py
TikTokApi\tiktok.py
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Build Status](https://travis-ci.com/davidteather/TikTok-Api.svg?branch=master)](https://travis-ci.com/davidteather/TikTok-Api)


# Unoffical TikTok API in Python

This is an unoffical api wrapper for tiktok.com in python. With this api you are able to call most trending and fetch specific user information.
Expand All @@ -21,22 +24,17 @@ If you need help installing or run into some error, please open an issue. I will
Tested with python 3.7.3

```
pip install requests
pip install selenium
pip install browsermob-proxy
pip install psutil
pip install TikTokApi
```

* You do need to have **java installed**.
Or install directly from this GitHub repo.

* You do need to have **java installed**
* Download browsermob-proxy [here](https://bmp.lightbody.net/)
* You must add **browsermob-proxy/bin** to your environment path.
* This library uses Browsermob-proxy, they are licensed under the apache2.0 license. Please make sure you adhere to their guidelines in /browsermob-proxy/LICENSE.txt
* **Firefox** must be installed.
* You must download the latest **geckodriver** from [mozilla](https://github.com/mozilla/geckodriver/releases), and include the .exe in your path.

Include whatever python script you want to run in the same directory as tiktok.py. Or just change the getTrending.py.

I will be looking for ways to shorten this installation in the future as it's a lot just for a TikTok API, however it does work 100% of the time after generating a new signature automatically.

## Quick Start Guide

Here's a quick bit of code to get the most recent trending on TikTok
Expand All @@ -56,10 +54,11 @@ api.trending(10)

```
# Variable set like
api = TikTokapi()
api = TikTokapi(path_to_browsermob_directory, headless=False)
```
path_to_browsermob_directory - String - should be the path from the directory you are running from the code to the extracted zip file of [browsermob-proxy](https://bmp.lightbody.net/)
headless - True/False - True means it will run a headless firefox browser, could be detected by TikTok, however it is more convienent. Default = False.

The program will then verify a signature by opening firefox tab and checking the network packets.

##### The Trending Method

Expand Down
1 change: 0 additions & 1 deletion TikTok-Api/__init__.py

This file was deleted.

203 changes: 0 additions & 203 deletions TikTok-Api/browsermob-proxy/LICENSE.txt

This file was deleted.

Loading

0 comments on commit 8aa1093

Please sign in to comment.