Skip to content

Commit 7da0891

Browse files
committed
fix auto.ps1 of windows
1 parent d578c89 commit 7da0891

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

2.28 KB
Binary file not shown.
810 Bytes
Binary file not shown.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ LeetCode
107107
|096|[Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees) | [C#](./Algorithms/UniqueBinarySearchTrees.cs)|Medium|
108108
|097|[Interleaving String](https://leetcode.com/problems/interleaving-string) | [C#](./Algorithms/InterleavingString.cs)|Hard|
109109
|098|[Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree) | [C#](./Algorithms/ValidateBinarySearchTree.cs)|Medium|
110-
|099|[Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/) | [C#](./Algorithms/RecoverBinarySearchTree.cs)|Hard|
111-
|100|[Same Tree](https://leetcode.com/problems/same-tree/) | [C#](./Algorithms/SameTree.cs)|Easy|
112-
|101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | [C#](./Algorithms/SymmetricTree.cs)|Easy|
113-
|102|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/description/) | [C#](./Algorithms/BinaryTreeLevelOrderTraversal.cs)|Medium|
110+
|099|[Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/) | [C#](./Algorithms/RecoverBinarySearchTree.cs)|Hard|
111+
|100|[Same Tree](https://leetcode.com/problems/same-tree/) | [C#](./Algorithms/SameTree.cs)|Easy|
112+
|101|[Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | [C#](./Algorithms/SymmetricTree.cs)|Easy|
113+
|102|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/description/) | [C#](./Algorithms/BinaryTreeLevelOrderTraversal.cs)|Medium|
114+
|103|[Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/description/) | [C#](./Algorithms/BinaryTreeZigzagLevelOrderTraversal.cs)|Medium|

Scripts/auto.ps1

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,20 @@ try {
2424
$HTML = Invoke-WebRequest -Uri $URL
2525
if ($IsWindows)
2626
{
27-
$QuestionContent = ($HTML.ParsedHtml.getElementsByTagName(meta) | where {$_.getAttributeNode('name').Value -eq 'description'} ).content.Split("`n")
27+
$QuestionContent = ($HTML.ParsedHtml.getElementsByTagName(meta) | where {$_.getAttributeNode('name').Value -eq 'description'} ).content.Split("`n").Trim()
2828
$QuestionTitle = (($HTML.ParsedHtml.getElementsByTagName(div) | Where{ $_.className -eq question-title clearfix })).innerText.Split("`n")[0]
29-
$DIFFCULT = ($HTML.ParsedHtml.getElementsByTagName(div) | Where{ $_.className -eq question-info text-info } ).innerText.Split("`n")[2].Split(":")[1].Trim()
30-
$NG = ($HTML.ParsedHtml.body.getElementsByTagName(div) | where {$_.getAttributeNode('ng-controller').Value -eq 'AceCtrl as aceCtrl'} )
31-
$JSON = $NG.getAttributeNode('ng-init').Value
29+
$DIFFCULT = $HTML.ParsedHtml.getElementByID(desktop-side-bar).innerText.Trim().Split("`n")[0].Split(":")[1].Trim()
30+
$JSON = ($HTML.ParsedHtml.body.getElementsByTagName(script) | Where{ $_.text -like '*codeDefinition*' }).text
3231
}
3332
else{
3433
$QuestionContent = ($HTML.Content | pup -p 'head meta[name=\"description\"] attr{content}').Split("`n")
3534
$QuestionTitle = ($HTML.Content | pup -p 'div[class=\"question-title clearfix\"] h3 text{}').Trim().Split("`n")[1]
3635
$DIFFCULT = ($HTML.Content | pup 'div#desktop-side-bar ul li span text{}').Split(":")[2].Trim()
37-
$JSON = ($HTML.Content | pup -p 'body script:contains(\"codeDefinition\") text{}') | Out-String
38-
$JSONSTART = $JSON.IndexOf("=") + 1
39-
$JSONLENGTH = $JSON.LastIndexOf(";") - $JSONSTART
40-
$JSON = $JSON.Substring($JSONSTART,$JSONLENGTH).Trim().Replace("\u003D","=").Replace("\u003B",";").Replace("\u003C","<").Replace("\u003E",">").Replace("\u000A","`n").Replace("\u000D","`n").Replace("\u000D\u000A","`n").Replace("\u0022","""")
36+
$JSON = ($HTML.Content | pup -p 'body script:contains(\"codeDefinition\") text{}') | Out-String
4137
}
38+
$JSONSTART = $JSON.IndexOf("=") + 1
39+
$JSONLENGTH = $JSON.LastIndexOf(";") - $JSONSTART
40+
$JSON = $JSON.Substring($JSONSTART,$JSONLENGTH).Trim().Replace("\u003D","=").Replace("\u003B",";").Replace("\u003C","<").Replace("\u003E",">").Replace("\u000A","`n").Replace("\u000D","`n").Replace("\u000D\u000A","`n").Replace("\u0022","""")
4241
$AUTHOR = $command
4342
$CURRENT_DATE = Get-Date -format F
4443
$NUM = $QuestionTitle.Split(".")[0].Trim().PadLeft(3).Replace(" ", "0")

0 commit comments

Comments
 (0)