View Single Post
  #31  
Old 05.01.2020, 15:28
zmv
Guest
 
Posts: n/a
Red face

The thing is Instagram generates different html depending on whether you are logged in or not. If you are not then the links to media files can be found in json node entry_data/PostPage where the decrypter will find them. However if you log in this node will be empty, the decrypter will find nothing. The media links will be instead in a separate json in another <script> tag.
You can easily fix this issue by checking if the user is logged in and if he is parsing the content of this tag.

Code:
if (parameter.matches(TYPE_GALLERY)) {
            /* Crawl single images & galleries */
            if (logged_in) {
                String graphql = br.getRegex(">window\\.__additionalDataLoaded\\('/p/[^/]+/'\\s*?,\\s*?(\\{.*?)\\);</script>").getMatch(0);
                entries = (LinkedHashMap<String, Object>) JavaScriptEngineFactory.jsonToJavaObject(graphql);
                resource_data_list = new ArrayList<>();
                resource_data_list.add(JavaScriptEngineFactory.walkJson(entries, "/"));
            } else {
                resource_data_list = (ArrayList) JavaScriptEngineFactory.walkJson(entries, "entry_data/PostPage");
            }
            for (final Object galleryo : resource_data_list) {
Reply With Quote