We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should probably speak to mtgjson about an explicit "Modern Legal flag" or something?
The text was updated successfully, but these errors were encountered:
I scrapped the legal sets from wotc website, so supposed to be okay
Sorry, something went wrong.
I’ll upload the code later
As long as wotc doesn't screw this page up, my scraper would get the set list correctly
`public static function getModernLegalSets() {
$url = 'https://magic.wizards.com/en/game-info/gameplay/formats/modern'; $options = [ 'http'=> [ 'method'=> 'GET', 'header'=> "Accept-language: en\r\n". "User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n", // i.e. An iPad ], ]; $context = stream_context_create($options); $htmlFull = @file_get_contents($url, false, $context); $dropdown = []; if($htmlFull!="") { $doc = new DOMDocument(); $internalErrors = libxml_use_internal_errors(true); $doc->loadHTML($htmlFull); libxml_use_internal_errors($internalErrors); $xpath = new DOMXPath($doc); foreach($xpath->query("//div[@id='gameinfo-formats-modern-2']") as $divContent) { if($ulList = $divContent->getElementsByTagName('ul')->item(1)) { $sets = $ulList->getElementsByTagName('li'); foreach($sets as $set) { //Some set names has non-breaking space, need to be removed $dropdown[] = str_replace( chr( 194 ) . chr( 160 ), '', $set->nodeValue); } } } } return $dropdown; }`
No branches or pull requests
Should probably speak to mtgjson about an explicit "Modern Legal flag" or something?
The text was updated successfully, but these errors were encountered: