Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Fixed sig parsing for youtube changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rylio committed Dec 18, 2015
1 parent d2096c2 commit a4671af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var actionsObjRegexp = regexp.MustCompile(fmt.Sprintf(

var actionsFuncRegexp = regexp.MustCompile(fmt.Sprintf(
"function(?: %s)?\\(a\\)\\{"+
"a=a\\.split\\(\"\"\\);"+
"a=a\\.split\\(\"\"\\);\\s*"+
"((?:(?:a=)?%s\\.%s\\(a,\\d+\\);)+)"+
"return a\\.join\\(\"\"\\)"+
"\\}", jsvarStr, jsvarStr, jsvarStr))
Expand All @@ -122,7 +122,7 @@ func getSigTokens(htmlPlayerFile string) ([]string, error) {
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return nil, fmt.Errorf("Error fetching sig tokens, status code %d", resp.StatusCode)
return nil, fmt.Errorf("Error fetching signature tokens, status code %d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
bodyString := string(body)
Expand All @@ -134,7 +134,7 @@ func getSigTokens(htmlPlayerFile string) ([]string, error) {
funcResult := actionsFuncRegexp.FindStringSubmatch(bodyString)

if len(objResult) < 3 || len(funcResult) < 2 {
return nil, fmt.Errorf("Error parsing sig tokens")
return nil, fmt.Errorf("Error parsing signature tokens")
}
obj := strings.Replace(objResult[1], "$", "\\$", -1)
objBody := strings.Replace(objResult[2], "$", "\\$", -1)
Expand Down

0 comments on commit a4671af

Please sign in to comment.