Untitled

 avatar
unknown
plain_text
2 years ago
3.0 kB
6
Indexable
  string cursor = "";
                            while (true)
                            {
                                if (isStopDownLoadVideo_FromG) break;
                                string html = request.GraphApi("&variables={\"count\":8,\"cursor\":\"" + cursor + "\",\"scale\":1.5,\"id\":\"" + job.TargetID + "\"}&doc_id=4203913266399451").Result;
                                if (string.IsNullOrEmpty(html)) break;
                                string idalbum = RegexMatch(html, "reference_token\":\"(.*?)\"").Groups[1].Value;
                                cursor = RegexMatch(html, "end_cursor\":\"(.*?)\"").Groups[1].Value;
                                var res = RegexMatches(html, "\"Photo\",\"id\":\"(\\d+)");
                                foreach (Match node in res)
                                {
                                    string idimg = node.Groups[1].Value;
                                    string getimg = request.GraphApi("&variables={\"UFI2CommentsProvider_commentsKey\":\"CometPhotoRootQuery\",\"displayCommentsContextEnableComment\":null,\"displayCommentsContextIsAdPreview\":null,\"displayCommentsContextIsAggregatedShare\":null,\"displayCommentsContextIsStorySet\":null,\"displayCommentsFeedbackContext\":null,\"feedbackSource\":65,\"feedLocation\":\"COMET_MEDIA_VIEWER\",\"focusCommentID\":null,\"isMediaset\":true,\"mediasetToken\":\"" + idalbum + "\",\"nodeID\":\"" + idimg + "\",\"privacySelectorRenderLocation\":\"COMET_MEDIA_VIEWER\",\"renderLocation\":\"permalink\",\"scale\":1,\"useDefaultActor\":false,\"useHScroll\":false}&doc_id=5816295931821345").Result;

                                    if (isStopDownLoadVideo_FromG) break;
                                    string url_hd = RegexMatch(getimg, "\"image\":{\"uri\":\"(.*?)\"").Groups[1].Value;
                                    if (!string.IsNullOrEmpty(url_hd))
                                    {
                                        Interlocked.Increment(ref demstart);
                                        url_hd = RegexUnescape(url_hd);
                                        string namefile = RegexMatch(url_hd, "/(\\d+)_(\\d+)_(\\d+)_n").Value;
                                        if (string.IsNullOrEmpty(namefile)) namefile = Guid.NewGuid().ToString();
                                        request.DownloadFile(url_hd, folder + "\\" + namefile.IsReplace("/", "") + ".jpg");
                                        this.Dispatcher.Invoke(() =>
                                        {
                                            DataDownloadIMG_fromG.Add(new GridRow() { ID = DataDownloadIMG_fromG.Count + 1, PageID = job.TargetID, Status1 = url_hd });
                                        });
                                        if (delay > 0) Task.Delay(1000 * delay).Wait();
                                    }
                                }
                                if (string.IsNullOrEmpty(cursor)) break;
                            }
Editor is loading...
Leave a Comment