Commit 97018653 authored by 黄奎's avatar 黄奎

页面修改

parent 447290d8
......@@ -25,6 +25,10 @@ namespace DotnetSpider.Spiders.Rules.SouthSastRule
public class SouthEastListSpider: Spider
{
public int pageNo = 1;
/// <summary>
/// 配置请求
/// </summary>
/// <returns></returns>
public static async Task RunAsync()
{
var builder = Builder.CreateDefaultBuilder<SouthEastListSpider>(options =>
......@@ -43,6 +47,11 @@ namespace DotnetSpider.Spiders.Rules.SouthSastRule
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="stoppingToken"></param>
/// <returns></returns>
protected override async Task InitializeAsync(CancellationToken stoppingToken)
{
AddDataFlow(new ListParser());
......@@ -84,6 +93,9 @@ namespace DotnetSpider.Spiders.Rules.SouthSastRule
await AddRequestsAsync(requests);
}
/// <summary>
/// 东南旅游数据解析
/// </summary>
protected class ListParser : DataParser
{
public ListParser()
......@@ -91,9 +103,15 @@ namespace DotnetSpider.Spiders.Rules.SouthSastRule
}
/// <summary>
/// 数据解析
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
protected override Task Parse(DataContext context)
{
var rootValue = JObject.Parse(context.Selectable.Value);
Console.WriteLine("SouthEastListSpider:" + rootValue);
if (rootValue != null)
{
var rootData = JObject.Parse(rootValue["data"].ToString());
......
......@@ -22,11 +22,24 @@ namespace DotnetSpider.Spiders.Rules.SouthSastRule
public async Task RunAsync()
{
Console.WriteLine("********* SouthEastService_Srart ***********");
//1、获取列表页数量
//await SouthEastListSpider.RunAsync();
Console.WriteLine("********* 2222222222222222222222 ***********");
//2、获取详情信息,补充列表不完善信息
var obj = new
{
code = "GFG0000000094",
no = "1",
travel_title_key = "0"
};
TRAVEL_CONFIGS.Add(new RB_Travel_Config()
{
KeyInfo = Newtonsoft.Json.JsonConvert.SerializeObject(obj)
});
await SouthEastDetailsSpider.RunAsync();
Console.WriteLine("********* SouthEastService_End ************");
////3、补充酒店,餐食等信息
//await BwtOtherDetailSpider.RunAsync();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment