Esempio n. 1
0
        public static void AddToCrawl(YouTubeLink link)
        {
            var path = "watch?v=" + link.Path;
            var yt   = new YouTube(path);

            Crawler.RegisterSite(yt);
        }
Esempio n. 2
0
        public async Task <IActionResult> PutYouTubeLink(int id, YouTubeLink youTubeLink)
        {
            if (id != youTubeLink.Id)
            {
                return(BadRequest());
            }

            _context.Entry(youTubeLink).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!YouTubeLinkExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 3
0
        public async Task <ActionResult <YouTubeLink> > PostYouTubeLink(YouTubeLink youTubeLink)
        {
            // _context.Links.Add(youTubeLink);
            // await _context.SaveChangesAsync();

            CrawlerManager.AddToCrawl(youTubeLink);

            return(CreatedAtAction(nameof(GetYouTubeLink), new { id = youTubeLink.Id }, youTubeLink));
        }
Esempio n. 4
0
 /// <summary>
 /// Opens the song at YouTube.com in a new tab
 /// </summary>
 public static void GoToYouTube()
 {
     YouTubeLink.Click();
 }