html转换和c#解释。 [英] html convertion and c# interpretation.

查看:58
本文介绍了html转换和c#解释。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您想更正此文字,请执行此操作!欢迎任何帮助。

我很抱歉不知道这篇文章的正确配方。我尽了最大努力。



我想在deviantart上为我观看的艺术家(我有3页用户,大约200页)轻松找到软件.COM。

要查看该网站上的用户页面,请按以下方式制定:http://q12a.deviantart.com/(这是我的帐户btw)



我不熟悉这个东西,网页解码并重新编码成c#。

我不知道怎么开始解释任何东西。

所有的c#代码都运行正常。

除非我运行程序,[某些]用户的[某些]图像,不想加载。



我看了在Firefox中进入网页源码(ctrl + u)。

我保存了该死的用户页面。

我在c#的断点处从字符串复制值 。



我能观察到的是,并非所有文字都是一样的,我的意思是:

来源来自firefox的页面,所有关键字都在他们的位置,干净整洁。如果我搜索关键字:data-super-img =我可以从该页面的每个图像链接中找到它。如果我以htm格式下载页面也是如此。

当我查看复制价值的事情时,事情发生了变化。

在文本的某些区域,data-super-img =关键字丢失!为什么?我最终检查了100次以获得这个答案。

由于一些非常模糊的原因,流阅读器可以避免一些关键字。

我不是在指责流阅读器。

大概可能是php,html阅读,html转换为流而不是页面相关的东西,hell知道。

也许我的HttpWebRequest / HttpWebResponse公式是不完全从流中转换。可能必须使用另一个公式,以实际将该流转换为HTML或其他东西。我真的不知道,我只是用我的直觉。



我不想留下我的垃圾邮件的印象,或者我在前面的新闻中推动艺术家。我的所有目的都是为了解决这个谜团,我将留下一个最充满不正当行为的例子(没有找到正确的链接)。

页面来自这位艺术家 - http://aeolus06.deviantart.com/gallery/

[SOME]页面表现出这种现象,即跳过关键字(或链接)但是大多数人都很好。



谢谢。

If you feel to correct this text, do it! Any help is welcome.
I am sorry for not knowing the correct formulation for this post. I did my best.

I want to make a easy to find software for my artists that I watch(and I have 3 pages with users,approx 200) on deviantart.com.
To view a user page on that website, just formulate as this: http://q12a.deviantart.com/ (this is my account btw)

I am new to this thing, web pages decoding and re-coding into c#.
I don't know how to even begin to explain anything.
All the c# code is working fine.
Except when I run the program, [some] images from [some] users, do not want to load.

I have looked into the web page source(ctrl+u) in Firefox.
I saved the damn user page.
I "copy the value" from the string at break point in c#.

What I can observe, is that not all the text is the same, and what i mean is that:
in the source page from firefox, all the keywords are at their place, nice and clean. If I search for keyword: "data-super-img=" I can find it for every image link from that page. The same is if I download the page in htm format.
The thing is changed when I looked into "copy the value" thing.
In some areas of the text, "data-super-img=" keyword is missing !!! Why? I checked like 100 times to get this answer in the end.
For some very obscured reason, some keywords are avoided by the stream reader.
I am not accusing the stream reader of anything.
Most than probably is a thing related by php, html reading, html converting into a stream and not into a page, hell knows.
Maybe my HttpWebRequest/HttpWebResponse formula is not converting completely from the stream. maybe another formula must be used, to actually convert that stream into a html, or something. I really don't know, I just use my intuition.

I dont want to leave the impression that i spam or that i push artists in the front news. All my intention is to solve this mystery, and I will leave an example that was the most full of misbehavior's like these(not finding the correct link).
the page is from this artist- http://aeolus06.deviantart.com/gallery/
[SOME] pages behave this phenomenon,of skipping the keywords(or links) but the majority is doing fine.

Thank you.

string streamx = "", file = "";
string urlx = "", text3564 = "", codRX = "";
int i7 = 0;

   public void userGallery()
       {
           streamx = ""; urlx = "";
           //http://q12a.deviantart.com/gallery/
           urlx = "http://" + listBox1.SelectedItem.ToString().ToLower() + ".deviantart.com/gallery/";
           linkLabel1.Text = urlx;

           //-------------------------------------------------------------
           //Special webpage Reading (extract info from page)
           HttpWebRequest request;
           HttpWebResponse response = null;
           Stream stream = null;
           request = (HttpWebRequest)WebRequest.Create(urlx);
           request.UserAgent = "Foo";
           request.Accept = "*/*";
           response = (HttpWebResponse)request.GetResponse();
           stream = response.GetResponseStream();

           StreamReader sr = new StreamReader(stream, System.Text.Encoding.Default);
           streamx = sr.ReadToEnd();
           if (stream != null) stream.Close();
           if (response != null) response.Close();
           //-------------------------------------------------------------
       //sample search for:  [ data-super-img="http://fc05.deviantart.net/fs70/f/2014/dante_by_w-d89.png" ]


       //First
           //cut the page at segment: [folderview-art] (to start from correct position)
           text3564 = streamx; codRX = urlx = ""; i7 = 0;
           i7 = text3564.IndexOf("<div class=\"folderview-art\">"); text3564 = text3564.Remove(0, i7);

           //Second
           //Sample Pics x6
           string st0 = "data-super-img=";
           if (text3564.Contains(st0))
           {
               //pic01
               i7 = text3564.IndexOf(st0); text3564 = text3564.Remove(0, i7);
               codRX = st0 + ".*?(\" )";
               urlx = Regex.Match(text3564, codRX).ToString().Replace(st0, "").Replace("\"", "");
               i7 = text3564.IndexOf(urlx); text3564 = text3564.Remove(0, i7 + urlx.Length);
               pictureBox3.ImageLocation = urlx;

               //pic02
               i7 = text3564.IndexOf(st0); text3564 = text3564.Remove(0, i7);
               codRX = st0 + ".*?(\" )";
               urlx = Regex.Match(text3564, codRX).ToString().Replace(st0, "").Replace("\"", "");
               i7 = text3564.IndexOf(urlx); text3564 = text3564.Remove(0, i7 + urlx.Length);
               pictureBox4.ImageLocation = urlx;

               //pic03...06 (i have 6 picture boxes)
          }
       }

   private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
       {
           userGallery();
       }

推荐答案

您的应用程序收到的网站内容与您的浏览器不同,因为您的浏览器您在DeviantArt上登录,但您的应用程序目前被网站视为匿名用户,因此无法获得相同的特权访问。
The website-content received by your application is different from your browser because with your browser you're "logged in" on DeviantArt, your application though is currently being treated as an anonymous user by the website and thus not getting the same privileged access.


这篇关于html转换和c#解释。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆