Ejemplo n.º 1
0
 public static async Task EventAsync(HttpClient client, Event ev)
 {
     //
     try
     {
         string uuri       = $"https://kudago.com/public-api/v1.4/events/{ev.id}/?lang=&fields=&expand=";
         var    stringTask = client.GetStringAsync(uuri);
         var    msg        = await stringTask;
         if (msg != null)
         {
             Event_desc evdesc = JsonConvert.DeserializeObject <Event_desc>(msg);
             if (evdesc.place != null)
             {
                 PlaceAsync(client, evdesc).Wait();
             }
         }
         else
         {
             //
         }
     }
     catch (Exception ex)
     {
         //
     }
 }
Ejemplo n.º 2
0
        public static async Task PlaceAsync(HttpClient client, Event_desc evdesc)
        {
            int    pid        = evdesc.place["id"];
            string uuri       = $"https://kudago.com/public-api/v1.4/places/{pid}/?lang=&fields=&expand=";
            var    stringTask = client.GetStringAsync(uuri);
            var    msg        = await stringTask;
            Place  plc        = JsonConvert.DeserializeObject <Place>(msg);

            File.AppendAllText("res.txt", SQLWriteEvent(evdesc, plc.coords));
        }
Ejemplo n.º 3
0
 public static string SQLWriteEvent(Event_desc evdesc, GPoint p)
 {
     try
     {
         Dictionary <string, long> dd = evdesc.dates[0];
         return($"INSERT INTO events(out_id, title, descr, categories, coords, url, start_date, end_date) " +
                $"VALUES ({evdesc.id}, \'{Regex.Escape(evdesc.title)}\', \'{Regex.Escape(evdesc.description)}\', \'{String.Join(", ", evdesc.categories)}\', {p.ToString()}, \'{Regex.Escape(evdesc.site_url)}\', FROM_UNIXTIME({dd["start"]}), FROM_UNIXTIME({dd["end"]}));");
     }
     catch (Exception ex)
     {
         return("");
     }
 }