Get player data and match via PUBG API

The programmer who do not know data analyze is not a good player in PUBG. πŸ™‚

I will show some tool method below

# this function get the player data by PUBG player name and return the json data

def get_player_data(name):
    headers = {
        "Authorization": "Bearer {}".format(PUBG_API_TOKEN),
        "Accept": "application/vnd.api+json",
    payload = {"filter[playerNames]": name}

    result = requests.get("", params=payload,headers=headers)
    return result.json()
# this function get the match data by match id and return the match data json
def get_matches_by_id(id):
    headers = {
        "Accept": "application/vnd.api+json",

    result = requests.get("{}".format(id),headers=headers)
    return result.json()

This post just show the tool function . The next post will show how to use it and extract data!

Use PyPDF2 to extract the PDF annotation


I use Foxit PDF reader to read PDF books and well as take some marks and comments in the PDF file.But the PDF reader do not provide the export function,maybe i can find the entry for the function..:)

So I try to use PyPDF to export the comment I written in PDF

The Code:

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from PyPDF2 import PdfFileReader
import types
def text_extractor(path,output_path):
    text_file = open(output_path,'w')

    with open(path, 'rb') as f:
        pdf = PdfFileReader(f)
        # get the 4 page start from 0
        page = pdf.getPage(4)
        # write the raw text in to file
        contents = page.extractText()
        # print you comment/annotation text to console
        annotations = page.get("/Annots").getObject()
        for annot in annotations:
                if annot is not None:
                        if annot.getObject().get("/Contents") is not None:
                        # .get("/Highlight").getObject())

if __name__ == '__main__':
    path = './youPDF.pdf'
    out_path = './test.txt'


When you fill you PDF filename and path ,and run the script . the raw test will save in test.txt file.You comments will show in the console.But the code show above,just process page 4.If you want to export all you comment.You must add a for loop to iterate all pages and extract the text!