THIS WILL HELP YOU GET THE IMAGE AND THE PARAGRAPH AND TITLE FROM YOUR WEBSITE!
如果你们想帮助你们,或获得第二形象,或者在评论中需要什么帮助,我将重写我的法典。
This is a answer quite late but I think it still might help in your future. You can go into parsing the website and that is the right way to do it but I will show you how to do it a different way, this can also be used to read xml, html, .com, anything and also, .rss so it can read RSS Feeds.
Here :
如果你要求我告诉你如何获得第二段,这可以得出你的第一个段落。 因此,如果你想获得钱,就会改变你的扫描仪,找到$
。 标题是名称,但如果不告诉我,我将向你们展示如何获得第二位头衔或标题。 见下文。 我将展示如何从整个网站获得html或xml,以便你能够看到网站的全文,看一看网站读一读,然后读到该代码。 你们看到,该守则中的狗名称找到了它的标题标签或标题之下或标题之下的东西,并且根据你的需要将该代码改为整个员额,以了解所有情况。 下面是如何获取信息的主要法典。 找到如何在贵国的Log或Console上登出网站的密码。 找到自己的形象,通过国家安全监督记录仪,看像www.example.com/images/image.jpg或图像等任何图像链接。 ng或图像,或一些图像延伸,看看一下哪一部法律正在像样起作用,或者在html和xml有100个图像代码,看着该代码,然后在你的扫描器将
>改为你的代码中加以使用,然后确保只有图像的缩略语在你无光色的情况下继续缩短。
So you have
页: 1
您将使用以下扫描器,并将
<>p>>改为
<media:content url:
,这样可以扫描,直到静态为止,如果你知道,该部分将永远扫描到那里,然后扫描器的第二部分用
<>>>>
结束。
参看第一部法典的主角。 这是我们需要变革的一部分——
缩略语
NSScanner *stringScanner2222 = [NSScanner scannerWithString:webString2222];
NSString *content2222 = [[NSString alloc] init];
//Change <p> to suit your need like <description> or <h1>
[stringScanner2222 scanUpToString:@"<p>" intoString:Nil];
[stringScanner2222 scanUpToString:@"." intoString:&content2222];
NSString *filteredTitle = [content2222 stringByReplacingOccurrencesOfString:@"<p>" withString:@""];
description.text = filteredTitle;
就我们而言,我们把这一部分改为:
[stringScanner2222 scanUpToString:@"<media:content url:"" intoString:Nil];
[stringScanner2222 scanUpToString:@"">" intoString:&content2222];
如今它有ur,但扫描器的第一部分始终保持这种使用——
NSString *filteredTitle = [content2222 stringByReplacingOccurrencesOfString:@"
然后利用这一数据下载图像——
NSURL * imageURL = [NSURL URLWithString:[filteredTitle stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation([UIImage imageWithData:[NSData dataWithContentsOfURL:imageURL]])];
UIImage * image = [UIImage imageWithData:imageData];
[imageView setImage:image];
//This is your URL
NSURL *URL = [NSURL URLWithString:@"URL HERE"];
//This is the data your pulling (dont change)
NSData *data = [NSData dataWithContentsOfURL:URL];
// Assuming data is in UTF8. (dont change)
NSString *string = [NSString stringWithUTF8String:[data bytes]];
//Your textView your not done.
description.text = string;
//Do this with your textview
NSString *webStringz = description.text;
// Leave this
NSString *mastaString;
mastaString = webStringz;
{
缩略语
NSScanner *stringScanner2222 = [NSScanner scannerWithString:webString2222];
NSString *content2222 = [[NSString alloc] init];
//Change <p> to suit your need like <description> or <h1>
[stringScanner2222 scanUpToString:@"<p>" intoString:Nil];
[stringScanner2222 scanUpToString:@"." intoString:&content2222];
NSString *filteredTitle = [content2222 stringByReplacingOccurrencesOfString:@"<p>" withString:@""];
description.text = filteredTitle;
}
Title ? Same deal change the <p>
to a <title>
in RSS <description>
and <title>
.
Image ? Same deal change the <p> to what ever your RSS or website uses to get a image to find
But remember for both of them when you change the
“你看一看描述的关联 同样,通过重新定位,也必须改变这种状况。
因此,你必须删除这一句,并照此行事。
//This is your URL
NSURL *URL = [NSURL URLWithString:@"URL HERE"];
//This is the data your pulling (dont change)
NSData *data = [NSData dataWithContentsOfURL:URL];
// Assuming data is in UTF8. (dont change)
NSString *string = [NSString stringWithUTF8String:[data bytes]];
//Your textView your not done.
description.text = string;
NLog(@"%@", string)
//Do this with your textview
NSString *webStringz = description.text;
// Leave this
NSString *mastaString;
mastaString = webStringz;
Now check your log it shows your whole website html or rss code then you scroll and read it and find your image link and check the code before it and change the String Scanner to your needs which is quite awesome and you have to change the stringByReplacingOccurences of.
Like I said images are a bit tricky when you do it with this method but XML Parsing is a lot easier ONCE you learn it , lol. If you request I will show you how to do it.
Tell me if your having problems looking through the html or xml and specify which website again and I will look through and I will tell you how to get everything you want.
Make sure :
If you want me to show you how to do it in XML just comment.
If you want me to show you how to find the second paragraph or image or title or something just comment.
红十字与红新月联会
如果与我提供的守则不相干,那么,任何错误的“审慎!!!!
iii