TeamNewPipe / TeamNewPipe/NewPipeExtractor

Change Regex and Selector Strings to Data/Language (Live) Parsing

Open
#77 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2k
Forks
602
Avg merge
3d 6h
Merged PRs (30d)
6

Description

The Problem

In this project the most data grabing things are done with a quick and dirty way (like always on the web), by using regex and selector strings.

Theoretic

The problem with this is regex and selector strings are not made for grabing data from the source. Selector strings come from css and jQuery and are mostly designed for create static websites (css) and interact with the xml of the html (jQuery/bouncer). Regex goes more in the direction of data grabing. But both got no high level functions implemented (join, trim, split) and on a lowlevel base the implementation is hard and mostly cost resources. Also Regex is not made for Language Parsing which made it hard for use it in the web.

Practical

This is used for parsing the client_id of soundcloud app from the javascript code.
,client_id:"(.*?)"
This regex is problematic because it depends on a name, even depends on a name writing norm and on a language norm of defining variables.

The name is less problematic than the other factors, because currently the most web projects are not completly minified, but still is a problem, because the complete minifying is possible and can change the name of key, id and endpoint variables.

The writing norm is somehow the same game like the name, but even on top of these this is not completly normed on the web. Because the Developers come from different directions some from python that write in the pip norm, some from Java with the Cemal Case Norm, even pure Javascript/EMACscript Developer or just other Developer that do not realy follow a Norm.

The language norm is the most problematic one Javascript/EMACscript is one of the most complex languages that exists, this caused by the number of version that get published without breaking with old norms. In this case the problem is the set/init(:) and split/separator(,) operator. Both got different characters that can be used, because their can be viewed in different contexts. The version of this regex strongly depends on shorthand object definition ({key:value,key:{...}, ...}) and even do not using trimmed strings, that easly can be passed by one simple space. Data can also be asigned by the using these = (, ; .) chars and a endpoint operator let var this.

[var |let |this.|x.]key=value,key=value,...

Solution

Language Norm Problem

Parsing languages and data formats. Live from the stream or from the completely downloaded data. Using a set of the following solutions for the single case. 😄

Best solution should be a whole new project or a web service that providing the id, keys, endpoints and other data are needed for using the private and public apis of the services.

Name Problem

Here you can use regex or programming rules on the extracted value, to get the right formated value and try it with try and error. Maybe you need to filter the values because of the attack with simply spam right values into the source code.

Writing Norm Problem

Parse different norms over and over again. Of Course this can be attack easily but with word parsing it can be nearly impossible. Maybe create a service for the ones who using the app for submit new words through the word database.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the SoundCloud client_id extraction and its current regex for JavaScript source, then review the other regex and selector-based parsing described in the issue. Done would require an agreed parsing approach and replacement scope; the issue does not name files, tests, or a specific implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.