/** * Execute the console command. * * @return mixed */ public function handle() { $client = new \Goutte\Client(); foreach (\MkmScraper\Card::all() as $card) { if ($card->todaysPrice()->count() < 1) { $crawler = $client->request('GET', 'https://www.magiccardmarket.eu/Products/Singles/' . rawurlencode($card->set) . '/' . rawurlencode($card->name)); \Log::info('https://www.magiccardmarket.eu/Products/Singles/' . rawurlencode($card->set) . '/' . rawurlencode($card->name)); $available = 0; $lowfinal = 0; $trendfinal = 0; try { if ($av = $crawler->filter('.sectioncontent .availTable .row_0 .cell_0_1')->first()) { $available = $av->text(); } if ($lo = $crawler->filter('.sectioncontent .availTable .row_1 .cell_1_1 span')->first()) { $low = $lo->text(); $lowfinal = str_replace(",", ".", $low); } if ($tr = $crawler->filter('.sectioncontent .availTable .row_2 .cell_2_1')->first()) { $trend = $tr->text(); $trendnumber = explode(" ", $trend); $trendfinal = str_replace(",", ".", $trendnumber[0]); } } catch (Exception $e) { print $e->getMessage(); } $cardPrice = \MkmScraper\CardPrice::create(array("id_card" => $card->id, "low" => $lowfinal, "trend" => $trendfinal, "sellers" => $available)); } } }
/** * Execute the console command. * * @return mixed */ public function handle() { foreach (\MkmScraper\Card::all() as $card) { $product = queryMKMAPI("product/" . $card->id); $articles = queryMKMAPI("articles/" . $card->id); $price = $product->product->priceGuide; $cardPrice = \MkmScraper\CardPrice::create(array("id_card" => $card->id, "sell" => $price->SELL, "low" => $price->LOW, "lowex" => $price->LOWEX, "lowfoil" => $price->LOWFOIL, "avg" => $price->AVG, "trend" => $price->TREND, "sellers" => sizeof($articles->article))); } }
public function getMovementData() { $date = "2015-09-03"; $objects = array(); while ($date < "2015-12-10") { //$object['sell']=\MkmScraper\CardPrice::getPriceWeek($date,$this); $object['price'] = \MkmScraper\GraphPrice::getPriceWeek($date, $this); $object['lowprice'] = \MkmScraper\CardPrice::getPriceWeek($date, $this); $object['singleprice'] = \MkmScraper\GraphPrice::getPriceSingleWeek($date, $this); $object['lowsingleprice'] = \MkmScraper\CardPrice::getPriceSingleWeek($date, $this); //$object['art']=\MkmScraper\Article::getArticlesWeek($date,$this); //$object['art']=\MkmScraper\Article::getArticlesWeek(date("Y-m-d",strtotime($date)+6*24*60*60),$this); //$object['art']=\MkmScraper\Article::getArticlesTwoWeek($date,$this); $object['sell'] = \MkmScraper\GraphPrice::getPriceDiffWeek($date, $this); $object['date'] = $date; //$object['sell']=\MkmScraper\CardPrice::getPriceDiffWeek($date,$this); //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getDiffWeek($date,$this)); $object['arttot'] = \MkmScraper\Article::getArticlesWeek($date, $this); $object['art'] = \MkmScraper\Article::getDiffWeek($date, $this); $object['tour'] = \MkmScraper\DecklistAppearance::tournamentLastWeek($date, $this); $object['tourdiff'] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 14 * 24 * 60 * 60), $this); $date = date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60); $objects[] = $object; } return $objects; }