Skip to content

Commit

Permalink
Handle rhx_gis hash
Browse files Browse the repository at this point in the history
  • Loading branch information
inDream committed May 7, 2018
1 parent df92ece commit 33ed0a3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"M": true,
"Matcher": true,
"Media": true,
"md5": true,
"moment": true
},
"overrides": {
Expand Down
1 change: 1 addition & 0 deletions app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"scripts": [
"scripts/chromereload.js",
"scripts/libs/chrome-promise.js",
"scripts/libs/md5.min.js",
"scripts/libs/moment.min.js",
"scripts/src/fetcher.js",
"scripts/src/database.js",
Expand Down
9 changes: 9 additions & 0 deletions app/scripts/src/fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ class Fetcher {
this.lastCursor = null;
this.query_id = '17866917712078875';
this.query_hash = 'd6f4427fbe92d846298cf93df0b937d3';
this.rhxGis = '';
}

getJSON(url) {
let variables = '';
if (url.indexOf('variables') > 0) {
variables = url.slice(url.indexOf('variables') + 10);
} else {
variables = `/${url.slice(0, url.indexOf('?'))}`;
}
const options = {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'X-Instagram-GIS': md5(`${this.rhxGis}:${variables}`),
},
credentials: 'include',
};
Expand Down Expand Up @@ -150,6 +158,7 @@ class Fetcher {
}
const data = JSON.parse(s.match(/({".*})/)[1]);
let feed = data.entry_data.FeedPage;
this.rhxGis = data.rhx_gis;
if (!feed) {
return Promise.reject();
}
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/src/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Media {
}

updateCache() {
return this.fetcher.getJSON(`p/${this.code}/?taken-by=${this.username}&__a=1`)
return this.fetcher.getJSON(`p/${this.code}/?__a=1`)
.then((body) => {
const media = body.graphql.shortcode_media;
if (media) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.4",
"description": "Provide what you expected from Instagram.",
"dependencies": {
"blueimp-md5": "^2.10.0",
"chrome-promise": "^2.0.2",
"isotope-layout": "^3.0.3",
"moment": "^2.18.1"
Expand Down

0 comments on commit 33ed0a3

Please sign in to comment.