Skip to content

Commit af0c459

Browse files
committed
Updated to 1.6.2 version
1 parent f8b8f2f commit af0c459

File tree

7 files changed

+82
-42
lines changed

7 files changed

+82
-42
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p align="center">
44
<a href="https://github.com/ssamadgh/WWDCsrt/releases" target="_blank">
5-
<img src="/https://img.shields.io/badge/Version-1.6.0-brightgreen.svg?style=flat" alt="app version 1.6.0">
5+
<img src="/https://img.shields.io/badge/Version-1.6.2-brightgreen.svg?style=flat" alt="app version 1.6.2">
66
</a>
77
<a href="https://developer.apple.com/swift/" target="_blank">
88
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
@@ -25,6 +25,12 @@
2525
#### An app for Download WWDC subtitles
2626

2727
### Whats New:
28+
29+
**version 1.6.2:**
30+
31+
- Now can download link of Sample codes for WWDC 2019, 2018, 2017, 2016 videos
32+
- Some minor bugs fixed
33+
2834
**version 1.6.1:**
2935

3036
- WWDC 2019 Added.

Releases/WWDC.srt.zip

2.74 KB
Binary file not shown.

WWDC.srt.xcodeproj/xcuserdata/SeyedSamad.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+19-35
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
condition = "self.sessionNumber == &quot;708&quot;"
300300
continueAfterRunningActions = "No"
301301
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
302-
timestampString = "571226522.972092"
302+
timestampString = "588417031.690729"
303303
startingColumnNumber = "9223372036854775807"
304304
endingColumnNumber = "9223372036854775807"
305305
startingLineNumber = "38"
@@ -316,11 +316,11 @@
316316
condition = "self.sessionNumber == &quot;708&quot;"
317317
continueAfterRunningActions = "No"
318318
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
319-
timestampString = "571226522.972165"
319+
timestampString = "588417031.690802"
320320
startingColumnNumber = "9223372036854775807"
321321
endingColumnNumber = "9223372036854775807"
322-
startingLineNumber = "75"
323-
endingLineNumber = "75"
322+
startingLineNumber = "78"
323+
endingLineNumber = "78"
324324
landmarkName = "executeOld()"
325325
landmarkType = "7">
326326
</BreakpointContent>
@@ -333,7 +333,7 @@
333333
condition = "self.sessionNumber == &quot;708&quot;"
334334
continueAfterRunningActions = "No"
335335
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
336-
timestampString = "571226522.9722281"
336+
timestampString = "588417031.690853"
337337
startingColumnNumber = "9223372036854775807"
338338
endingColumnNumber = "9223372036854775807"
339339
startingLineNumber = "46"
@@ -350,11 +350,11 @@
350350
condition = "self.sessionNumber == &quot;708&quot;"
351351
continueAfterRunningActions = "No"
352352
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
353-
timestampString = "571226522.972288"
353+
timestampString = "588417031.690889"
354354
startingColumnNumber = "9223372036854775807"
355355
endingColumnNumber = "9223372036854775807"
356-
startingLineNumber = "83"
357-
endingLineNumber = "83"
356+
startingLineNumber = "86"
357+
endingLineNumber = "86"
358358
landmarkName = "executeOld()"
359359
landmarkType = "7">
360360
</BreakpointContent>
@@ -367,7 +367,7 @@
367367
condition = "self.sessionNumber == &quot;708&quot;"
368368
continueAfterRunningActions = "No"
369369
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
370-
timestampString = "571226522.97235"
370+
timestampString = "588417031.690924"
371371
startingColumnNumber = "9223372036854775807"
372372
endingColumnNumber = "9223372036854775807"
373373
startingLineNumber = "51"
@@ -384,7 +384,7 @@
384384
condition = "self.sessionNumber == &quot;708&quot;"
385385
continueAfterRunningActions = "No"
386386
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
387-
timestampString = "571226522.97242"
387+
timestampString = "588417031.690958"
388388
startingColumnNumber = "9223372036854775807"
389389
endingColumnNumber = "9223372036854775807"
390390
startingLineNumber = "61"
@@ -401,7 +401,7 @@
401401
condition = "self.sessionNumber == &quot;708&quot;"
402402
continueAfterRunningActions = "No"
403403
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
404-
timestampString = "571226522.972479"
404+
timestampString = "588417031.690992"
405405
startingColumnNumber = "9223372036854775807"
406406
endingColumnNumber = "9223372036854775807"
407407
startingLineNumber = "67"
@@ -417,27 +417,11 @@
417417
ignoreCount = "0"
418418
continueAfterRunningActions = "No"
419419
filePath = "WWDCSubGetter/WWDCVideosController.swift"
420-
timestampString = "571226522.97254"
420+
timestampString = "588417031.691027"
421421
startingColumnNumber = "9223372036854775807"
422422
endingColumnNumber = "9223372036854775807"
423-
startingLineNumber = "183"
424-
endingLineNumber = "183"
425-
landmarkName = "getStringContent(fromURL:)"
426-
landmarkType = "7">
427-
</BreakpointContent>
428-
</BreakpointProxy>
429-
<BreakpointProxy
430-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
431-
<BreakpointContent
432-
shouldBeEnabled = "No"
433-
ignoreCount = "0"
434-
continueAfterRunningActions = "No"
435-
filePath = "WWDCSubGetter/WWDCVideosController.swift"
436-
timestampString = "571226522.972903"
437-
startingColumnNumber = "9223372036854775807"
438-
endingColumnNumber = "9223372036854775807"
439-
startingLineNumber = "213"
440-
endingLineNumber = "213"
423+
startingLineNumber = "261"
424+
endingLineNumber = "261"
441425
landmarkName = "downloadFile(urlString:forSession:)"
442426
landmarkType = "7">
443427
</BreakpointContent>
@@ -449,11 +433,11 @@
449433
ignoreCount = "0"
450434
continueAfterRunningActions = "No"
451435
filePath = "WWDCSubGetter/WWDCVideosController.swift"
452-
timestampString = "571226522.973217"
436+
timestampString = "588417031.691063"
453437
startingColumnNumber = "9223372036854775807"
454438
endingColumnNumber = "9223372036854775807"
455-
startingLineNumber = "172"
456-
endingLineNumber = "172"
439+
startingLineNumber = "217"
440+
endingLineNumber = "217"
457441
landmarkName = "getStringContent(fromURL:)"
458442
landmarkType = "7">
459443
</BreakpointContent>
@@ -689,7 +673,7 @@
689673
ignoreCount = "0"
690674
continueAfterRunningActions = "No"
691675
filePath = "WWDCSubGetter/WWDCVideosController.swift"
692-
timestampString = "571226522.973803"
676+
timestampString = "588417031.691193"
693677
startingColumnNumber = "9223372036854775807"
694678
endingColumnNumber = "9223372036854775807"
695679
startingLineNumber = "123"
@@ -721,7 +705,7 @@
721705
ignoreCount = "0"
722706
continueAfterRunningActions = "No"
723707
filePath = "WWDCSubGetter/WWDCVideosController.swift"
724-
timestampString = "571226522.9741811"
708+
timestampString = "588417031.6912481"
725709
startingColumnNumber = "9223372036854775807"
726710
endingColumnNumber = "9223372036854775807"
727711
startingLineNumber = "92"

WWDCSubGetter/Base.lproj/Main.storyboard

+1-2
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@
510510
</subviews>
511511
</view>
512512
<color key="borderColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
513-
<color key="fillColor" red="0.83741801979999997" green="0.83743780850000005" blue="0.83742713930000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
514513
</box>
515514
</subviews>
516515
</customView>
@@ -645,7 +644,7 @@ DQ
645644
<rect key="frame" x="44" y="42" width="37" height="17"/>
646645
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="XAd-t5-Ibg">
647646
<font key="font" metaFont="system"/>
648-
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
647+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
649648
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
650649
</textFieldCell>
651650
</textField>

WWDCSubGetter/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.6.1</string>
20+
<string>1.6.2</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>LSApplicationCategoryType</key>

WWDCSubGetter/ParseHtmlVideoPageOperation.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ class ParseHtmlVideoPageOperation: Operation {
6666
case .sampleCode:
6767
let sampleCodesURLStrings = WWDCVideosController.getSampleCodeURL(fromHTML: htmlText)
6868
let sampleCodesURLStrings2 = WWDCVideosController.getSampleCodeURL2(fromHTML: htmlText)
69-
69+
let sampleCodesURLStrings3 = WWDCVideosController.getSampleCodeURL3(fromHTML: htmlText)
70+
7071
linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings)
7172
linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings2)
73+
linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings3)
74+
7275

7376
}
7477
}

WWDCSubGetter/WWDCVideosController.swift

+50-2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,51 @@ class WWDCVideosController {
155155
return sampleURLPaths
156156
}
157157

158+
class func getSampleCodeURL3(fromHTML: String) -> [String] {
159+
// let pat = "(href=\"[^ ]*?/content/samplecode/.*?=\")"
160+
let pat = "href=\"([^ ]*?/documentation/.*?)\""
161+
let regex = try! NSRegularExpression(pattern: pat, options: [])
162+
let matches = regex.matches(in: fromHTML, options: [], range: NSRange(location: 0, length: fromHTML.count))
163+
var sampleURLPaths : [String] = []
164+
for match in matches {
165+
let range = match.range(at: 1)
166+
var path = (fromHTML as NSString).substring(with: range)
167+
168+
// Tack on the hostname if it's not already there (some URLs are listed as
169+
// relative URL while some are fully-qualified).
170+
let prefixReplacementString: String
171+
if !path.contains("href=\"http") {
172+
prefixReplacementString = "http(?:s)?://developer.apple.com"
173+
} else {
174+
prefixReplacementString = ""
175+
}
176+
path = path.replacingOccurrences(of: "href=\"", with: prefixReplacementString)
177+
178+
// Strip target attribute suffix
179+
path = path.replacingOccurrences(of: "\" target=\"", with: "/")
180+
181+
sampleURLPaths.append(path)
182+
}
183+
184+
var sampleArchivePaths : [String] = []
185+
for urlPath in sampleURLPaths {
186+
let htmlText = getStringContent(fromURL: urlPath)
187+
188+
let pat = "href=\"([^ ]*?/published/.*?.zip)\""
189+
let regex = try! NSRegularExpression(pattern: pat, options: [])
190+
let matches = regex.matches(in: htmlText, options: [], range: NSRange(location: 0, length: htmlText.count))
191+
for match in matches {
192+
let range = match.range(at: 1)
193+
let path = (htmlText as NSString).substring(with: range)
194+
195+
sampleArchivePaths.append(path)
196+
}
197+
198+
}
199+
200+
return sampleArchivePaths
201+
}
202+
158203

159204
class func getStringContent(fromURL: String) -> (String) {
160205
/* Configure session, choose between:
@@ -184,8 +229,11 @@ class WWDCVideosController {
184229
/* Success */
185230
// let statusCode = (response as! NSHTTPURLResponse).statusCode
186231
// print("URL Session Task Succeeded: HTTP \(statusCode)")
187-
result = String.init(data: data!, encoding:
188-
.utf8)!
232+
if let data = data, let string = String.init(data: data, encoding:
233+
.utf8) {
234+
result = string
235+
236+
}
189237
}
190238
else {
191239
/* Failure */

0 commit comments

Comments
 (0)