Giter Site home page Giter Site logo

pyszne_crowler's Introduction

A small experimental web scraping project.

The target site is https://www.pyszne.pl

The task is to get the contact details of all restaurants in Poland.

The target site uses Cloudflare protection with rather poor settings. The Cloudflare-protected pages can be bypassed with correct headers and httpx.

Another feature of the site is the switch to cw-api.takeaway for internal product pages. For cw-api.takeaway pages, the user agent validator is poorly implemented. The use of invalid useragents bypasses the protection of the IP-user-agent mapping constraint checks. However, increased server load will result in IP restriction of requests. So one way to develop IP connectivity.

Scripts can be accelerated using a proxy, but avoid unnecessary load on the site if you don't need to.

Navigation pages are cached because they are rarely modified data. However, there is no caching for the regions page as this content changes more frequently.

If you plan to use the script for research or learning, please use the url_cache decorator for the request function. This will consume more than 30 gigabytes of disk space, but you won't increase the load on the target site.

One goal of the experiment is to create a fully asynchronous script, synchronising execution by checking the number of tasks in the event pool.

TODO

Based on traffic analysis of the mobile app, we can retrieve data about the restaurant using the following queries

https://pl-cdn.citymeal.com/ws/6.15/getrestaurantdata/{key}/en https://pl-cdn.citymeal.com/ws/6.15/getrestaurantdatacheckout/{key}/en

with headers

headers = {
    "Platform": "androidtablet",
    "Appname": "Pyszne.pl",
    "Appversion": "8.30.0",
    "Systemversion": "33;8.30.0",
    "Accept-Encoding": "gzip, deflate",
    "User-Agent": "okhttp/4.10.0",
}

The current problem is getting restaurant data through the api of the mobile app. They use a key with an md5 cache based on other keys. Perhaps there are some sort of salts. We need to determine an algorithm

sample

``python url = "https://pl.citymeal.com/androidtablet/at.php/?"

data = var0=09024b6dd1e8770cda58bb27229f98ac&var1=getrestaurants&var2=&var3=180&var4=52.2380508&var5=20.9856886&var6=en&var7=0&var8=1&var10=0&version=5.40&systemversion=33%3B8.30.08.30.0&appname=Pyszne.pl&language=en

headers = """Content-Type: application/x-www-form-urlencoded;charset=UTF-8 Content-Length: 209 Accept-Encoding: gzip, deflate User-Agent: okhttp/4.10.0""

pyszne_crowler's People

Contributors

mantisus avatar

Watchers

 avatar

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.